package org.t236.commons.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class AjaxResult {
    public static final int SUCCESS = 200;
    public static final int ERROR = 500;
    private int code;
    private String msg;
    private Object data;

    public static AjaxResult success(Object data) {
        return new AjaxResult(SUCCESS, "success", data);
    }
    public static AjaxResult success() {
        return new AjaxResult(SUCCESS, "success", null);
    }

    public static AjaxResult error(String msg) {
        return new AjaxResult(ERROR, msg, null);
    }
}
